//
//  ViewController.m
//  UITextField
//
//  Created by clz on 2019/8/3.
//  Copyright © 2019年 clz. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UITextFieldDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //UItextField
    UITextField *textField = [[UITextField alloc]init];
    textField.delegate = self;
    textField.backgroundColor = [UIColor redColor];
    textField.textColor = [UIColor whiteColor];
    textField.font = [UIFont systemFontOfSize:18];
    textField.placeholder = @"请输入账户名";
    [self.view addSubview:textField];
    textField.frame = CGRectMake(0, 50, self.view.frame.size.width, 50);
}


- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
    
}

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
    NSLog(@"开始编辑");
    return YES;
}

- (void)textFieldDidEndEditing:(UITextField *)textField{
    NSLog(@"编辑结束 = %@",textField.text);
}




@end
